<template>
  <div>
    <div class="exampletwo" style="display: flex;">
      <van-image style="padding: 3px;padding-left: 10px" round width="1.2rem" height="1.2rem"
        src="https://cdn.uviewui.com/uview/album/1.jpg" />
      <van-tag type="primary" size="large">欢迎回家,祝各位司机师父一路平安,多接大单.</van-tag>
    </div>
    <van-notice-bar color="#1989fa" background="#ecf9ff" left-icon="volume-o"
      text="在代码阅读过程中人们说脏话的频率是衡量代码质量的唯一标准。" />
    <div style="margin-top: 10px;">

    </div>
    <div style="margin-top: -5px;">
      <van-divider :style="{ color: '#1989fa', borderColor: '#1989fa', padding: '0 16px' }"
        @click="login">
        请登录
      </van-divider>
    </div>
    <div class="div_class">
      <van-form @submit="login">
        <van-field v-model="phone" label="手机号码:" placeholder="请输入手机号码." />
        <van-field v-model="password" label="密码:" placeholder="请输入4位数识别码." />
        <van-field v-model="code" label="卡密:" placeholder="请输入您购买的算法卡密." />
        <div style="margin: 16px;">
          <van-button round block type="info" native-type="submit">登录抢单助手</van-button>
        </div>
      </van-form>
    </div>
  </div>
</template>

<script>
import axios from "axios";
import router from "@/router";
export default {
  data() {
    return {
      active: 3,
      phone: "",
      password: "",
      code: "",
      isCheck: "",
      loginInfo: {
        phone: "",
        password: "",
        key: "",
      },
    };
  },
  created() {},
  methods: {
    onSubmit(values) {
      console.log("submit", values);
    },
    login() {
      this.loginInfo.phone = this.phone;
      this.loginInfo.password = this.password;
      this.loginInfo.key = this.code;
      axios
        .get("http://123.60.46.49:8080/login/loginUser", {
          params: this.loginInfo,
        })
        .then((res) => {
          if (res.data.code === 500) {
            this.$message.error("服务未启动或奔溃请联系客户.");
          } else {
            this.$message({
              message: res.data.message,
              type: "success",
            });
            router.push("/my?phone=" + this.loginInfo.phone);
          }
        });
    },
  },
};
</script>
<style>
.exampletwo {
  background-color: rgb(22, 136, 241);
  color: rgb(255, 255, 204);
}

.div_class {
  margin-top: -25px;
}
</style>